package cn.njxzc.examples;

class A14 {
	public int a1 = 5;
	public int a2 = 4;
	protected int a3 = 3;
	int a4 = 2;

	int geta4() {
		return a4;
	}
}

class B14 extends A14 {
	int b1 = 1;

	int sum() {
		return b1 + a1 + a2 + a3 + geta4();
	}

}

class Exam3_14

{
	public static void main(String[] args) {
		A14 a = new A14();
		B14 b = new B14();
		System.out.println(a.a4);//p109的表述不合适
		int sumA = a.a1 + a.a2 + a.a3 + a.geta4();
		int sumB = sumA + b.b1;
		System.out.println("A14:" + sumA);
		System.out.println("B14:" + sumB + ",B14:" + b.sum());
	}

}
